package com.qiangesoft.bootcodegen.controller;

import com.qiangesoft.bootcodegen.entity.BcgOperationLog;
import com.qiangesoft.bootcodegen.framework.log.Log;
import com.qiangesoft.bootcodegen.pojo.query.BcgOperationLogQuery;
import com.qiangesoft.bootcodegen.pojo.query.PageQuery;
import com.qiangesoft.bootcodegen.pojo.vo.PageResultVO;
import com.qiangesoft.bootcodegen.service.IBcgOperationLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 操作日志 前端控制器
 * </p>
 *
 * @author qiangesoft
 * @date 2024-04-01
 */
@Api(tags = "操作日志")
@RequiredArgsConstructor
@RestController
@RequestMapping("/operationLog")
public class BcgOperationLogController {

    private final IBcgOperationLogService operationLogService;

    @ApiOperation(value = "查询日志")
    @GetMapping
    public PageResultVO<BcgOperationLog> listOperationLog(@Validated PageQuery pageQuery, BcgOperationLogQuery operationLogQuery) {
        return operationLogService.listOperationLog(pageQuery, operationLogQuery);
    }

    @Log(module = "操作日志", operationName = "删除日志")
    @ApiOperation(value = "删除日志")
    @DeleteMapping("/{ids}")
    public void removeOperationLog(@PathVariable List<Long> ids) {
        operationLogService.removeBatchByIds(ids);
    }

}
